#include <memory>
#include <iostream>
struct son;
struct father
{
    std::shared_ptr<son> sonptr;
    ~father()
    {
        std::cout<<"End Father"<<std::endl;
    }
};

struct son
{
    std::shared_ptr<father> faptr;
    ~son()
    {
        std::cout<<"End Son"<<std::endl;
    }
};

int main()
{
    std::shared_ptr<father> fptr = std::make_shared<father>();
    std::shared_ptr<son> sptr = std::make_shared<son>();
    std::cout<<fptr.use_count()<<std::endl;
    std::cout<<sptr.use_count()<<std::endl;
    fptr->sonptr = sptr;
    sptr->faptr = fptr;
}